#ifndef XC330_REG_H
#define XC330_REG_H

/* Control Table Address */
#define ModelNumber 0
#define ModelInformation 2
#define FirmwareVersion 6
#define ID 7
#define BaudRate 8
#define ReturnDelayTime 9
#define DriveMode 10
#define OperatingMode 11
#define SecondaryID 12
#define ProtocolType 13
#define HomingOffset 20
#define MovingThreshold 24
#define TemperatureLimit 31
#define MaxVoltageLimit 32
#define MinVoltageLimit 34
#define PWMLimit 36
#define CurrentLimit 38
#define VelocityLimit 44
#define MaxPositionLimit 48
#define MinPositionLimit 52
#define Shutdown 63
#define TorqueEnable 64
#define LED 65
#define StatusReturnLevel 68
#define RegisteredInstruction 69
#define HardwareErrorStatus 70
#define Velocity_I_Gain 76
#define Velocity_P_Gain 78
#define Position_D_Gain 80
#define Position_I_Gain 82
#define Position_P_Gain 84
#define Feedforward_2nd_Gain 88
#define Feedforward_1st_Gain 90
#define BusWatchdog 98
#define Goal_PWM 100
#define Goal_Current 102
#define Goal_Velocity 104
#define Profile_Acceleration 108
#define Profile_Velocity 112
#define Goal_Position 116
#define Realtime_Tick 120
#define Moving 122
#define Moving_Status 123
#define Present_PWM 124
#define Present_Current 126
#define Present_Velocity 128
#define Present_Position 132
#define Velocity_Trajectory 136
#define Position_Trajectory 140
#define Present_Input_Voltage 144
#define Present_Temperature 146

/* Data Length (Byte)*/
#define ModelNumber_Len 2
#define ModelInformation_Len 4
#define FirmwareVersion_Len 1
#define ID_Len 1
#define BaudRate_Len 1
#define ReturnDelayTime_Len 1
#define DriveMode_Len 1
#define OperatingMode_Len 1
#define SecondaryID_Len 1
#define ProtocolType_Len 1
#define HomingOffset_Len 4
#define MovingThreshold_Len 4
#define TemperatureLimit_Len 1
#define MaxVoltageLimit_Len 2
#define MinVoltageLimit_Len 2
#define PWMLimit_Len 2
#define CurrentLimit_Len 2
#define VelocityLimit_Len 4
#define MaxPositionLimit_Len 4
#define MinPositionLimit_Len 4
#define Shutdown_Len 1
#define TorqueEnable_Len 1
#define LED_Len 1
#define StatusReturnLevel_Len 1
#define RegisteredInstruction_Len 1
#define HardwareErrorStatus_Len 1
#define Velocity_I_Gain_Len 2
#define Velocity_P_Gain_Len 2
#define Position_D_Gain_Len 2
#define Position_I_Gain_Len 2
#define Position_P_Gain_Len 2
#define Feedforward_2nd_Gain_Len 2
#define Feedforward_1st_Gain_Len 2
#define BusWatchdog_Len 1
#define Goal_PWM_Len 2
#define Goal_Current_Len 2
#define Goal_Velocity_Len 4
#define Profile_Acceleration_Len 4
#define Profile_Velocity_Len 4
#define Goal_Position_Len 4
#define Realtime_Tick_Len 2
#define Moving_Len 1
#define Moving_Status_Len 1
#define Present_PWM_Len 2
#define Present_Current_Len 2
#define Present_Velocity_Len 4
#define Present_Position_Len 4
#define Velocity_Trajectory_Len 4
#define Position_Trajectory_Len 4
#define Present_Input_Voltage_Len 2
#define Present_Temperature_Len 1

/* Instruction */
#define PING 0x01
#define READ 0x02
#define WRITE 0x03
#define REG_WRITE 0x04
#define ACTION 0x05
#define RESET 0x06
#define REBOOT 0x08
#define CLEAR 0x10
#define STATUS 0x55
#define SYNC_READ 0x82
#define SYNC_WRITE 0x83
#define BULK_READ 0x92
#define BULK_WRITE 0x93
#endif // !XC330_REG_H
